Mivhak.component(ꞌtoggleꞌ).created   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 3
rs 10
1
Mivhak.component('toggle', {
0 ignored issues
show
Bug introduced by
The variable Mivhak seems to be never declared. If this is a global, consider adding a /** global: Mivhak */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
2
    template: '<div class="mivhak-toggle"><div class="mivhak-toggle-knob"></div></div>',
3
    props: {
4
        on: true
5
    },
6
    events: {
7
        click: function() {
8
            this.toggle();
9
        }
10
    },
11
    created: function() {
12
        this.$el.addClass('mivhak-toggle-'+(this.on?'on':'off'));
13
    },
14
    methods: {
15
        toggle: function() {
16
            this.on = !this.on;
17
            this.$el.toggleClass('mivhak-toggle-on').toggleClass('mivhak-toggle-off');
18
        }
19
    }
20
});